package com.community.controller;


import com.community.base.BaseController;
import com.community.common.Const;
import com.community.common.ServerResponse;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/labelController/")
@CrossOrigin(origins = Const.REQUESTURL,maxAge = 3600,allowCredentials = "true")
public class LabelController extends BaseController {

    /**
     * 新增标签
     * @param name
     * @param request
     * @return
     */
    @PostMapping("add.do")
    public ServerResponse<String> add(@RequestParam(value = "name") String name, HttpServletRequest request){
        return iLabelService.add(name,request);
    }

    /**
     *  删除标签
     * @param id
     * @param request
     * @return
     */
    @PostMapping("del.do")
    public ServerResponse<String> del(int id,HttpServletRequest request){
        return iLabelService.del(id,request);
    }

    /**
     * 查询所有标签
     * @return
     */
    @GetMapping("selectAllLabel.do")
    public ServerResponse<List<Map>> selectAllLabel(){
        return iLabelService.selectAllLabel();
    }

}
